package com.cdn.nodes.api;

import com.cdn.common.core.constant.ServiceNameConstants;
import com.cdn.common.core.domain.R;
import com.cdn.nodes.api.factory.RemoteClusterFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@FeignClient(contextId = "remoteClusterService",
        value = ServiceNameConstants.NODE_SERVICE,
        fallbackFactory = RemoteClusterFallbackFactory.class)
public interface RemoteClusterService {

    /**
     * 获取当前集群下的所有节点
     */
    @GetMapping("/clusters/getNodesByClusterId/{cluster}")
    public R<List<Long>> getNodesByClusterId(@PathVariable("cluster") Long cluster);

    /**
     * 根据集群Id获取集群Dns
     */
    @GetMapping("/clusters/getDnsByClusterId/{cluster}")
    public R<String> getDnsByClusterId(@PathVariable("cluster") Long cluster);

    /**
     *  获取集群ssh认证
     */
    @GetMapping("/clusters/getClusterSsh/{cluster}")
    public R<String> getClusterSsh(@PathVariable("cluster") Long cluster);
}
